/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.alipay.sofa.registry.task.batcher;

/**
 * @author Tomasz Bak
 *
 * @author shangyu.wh modify
 * @version $Id: TaskHolder.java, v 0.1 2017-11-14 14:57 shangyu.wh Exp $
 */
public class TaskHolder<ID, T> {

    private final ID   id;
    private final T    task;
    private final long expiryTime;
    private final long submitTimestamp;

    /**
     * constructor
     * @param id
     * @param task
     * @param expiryTime
     */
    TaskHolder(ID id, T task, long expiryTime) {
        this.id = id;
        this.expiryTime = expiryTime;
        this.task = task;
        this.submitTimestamp = System.currentTimeMillis();
    }

    /**
     * Getter method for property <tt>id</tt>.
     *
     * @return property value of id
     */
    public ID getId() {
        return id;
    }

    /**
     * Getter method for property <tt>task</tt>.
     *
     * @return property value of task
     */
    public T getTask() {
        return task;
    }

    /**
     * Getter method for property <tt>expiryTime</tt>.
     *
     * @return property value of expiryTime
     */
    public long getExpiryTime() {
        return expiryTime;
    }

    /**
     * Getter method for property <tt>submitTimestamp</tt>.
     *
     * @return property value of submitTimestamp
     */
    public long getSubmitTimestamp() {
        return submitTimestamp;
    }
}